<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>系统用户管理</title> <#include "/WEB-INF/content/module-index.html">
<script type="text/javascript">
	var sysStatus = {
			<#list map["status"] as sysStatus>
			<#if sysStatus_index!=0>
			,
			</#if>
              "${sysStatus.ecode}":"${sysStatus.ename}"
			</#list>
	};
	var sysGroup = {
       		<#list map["group"] as sysGroup>
       		<#if sysGroup_index!=0>
       		,
       		</#if>
               "a${sysGroup.code}":"${sysGroup.groupName}"
       		</#list>
	};
	function statusFormatter(value,rowData,rowIndex){
	 	if(value&&value!="")
		return eval("sysStatus."+value);
		else
			return "未知"; 
	}
	function groupFormatter(value,rowData,rowIndex){
	 	if(value&&value!="")
		return eval("sysGroup.a"+value);
		else
			return "未知"; 
	}
	function reset() {
		var selectItemId = getSelectItemId();
		if(preset())return;
		if (selectItemId) {
			if (isConfirm()) {
				var baseUrl = moduleUrl.substring(0,moduleUrl.lastIndexOf("/") );
				$.post(baseUrl + "/" + selectItemId + "/reset", function(data) {
					var msg = "操作失败";
					if (data.state) {
						if (data.info)
							msg = data.info;
						else
							msg = "操作成功";
						$("#grid").datagrid("reload");
					} else {
						if (data.info)
							msg = data.info;
					}
					top.showMsg(msg);
				});
			}

		}
	}
	function refurbish(){
			if (window.confirm('是否继续执行操作？')) {
				var baseUrl = moduleUrl.substring(0,moduleUrl.lastIndexOf("/") );
				$.post(baseUrl + "/refurbish", function(data) {
					var msg = "操作失败";
					if (data.state) {
						if (data.info)
							msg = data.info;
						else
							msg = "操作成功";
					} else {
						if (data.info)
							msg = data.info;
					}
					top.showMsg(msg);
				});
			}
	}
	
</script>
</head>
<body>
<body class="easyui-layout">
	<div region="center" style="padding: 5px; background: #eee;">
		<div id="toolbar">
			<@auth code="sys:user:new"><a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-add" style="border: 1px solid #ccc"
				onclick="javascript:add()">新增</a> </@auth> <@auth
			code="sys:user:*:edit"> <a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-edit" style="border: 1px solid #ccc"
				onclick="javascript:edit()">编辑</a></@auth> <@auth
			code="sys:user:*:reset"> <a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-edit" style="border: 1px solid #ccc"
				onclick="javascript:reset()">重置密码</a> </@auth> <@auth
			code="sys:user:refurbish"> <a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-edit" style="border: 1px solid #ccc"
				onclick="javascript:refurbish()">刷新所有用户权限</a></@auth> <@auth
			code="sys:user:*:delete"> <a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-remove" style="border: 1px solid #ccc"
				onclick="javascript:del()">删除</a></@auth> <@auth
			code="sys:user:*:destroy"> <a href="#" class="easyui-linkbutton"
				plain="true" iconCls="icon-remove" style="border: 1px solid #ccc"
				onclick="javascript:destroy()">销毁</a></@auth>

		</div>
		<table id="grid" class="easyui-datagrid" url="query" idField="account"
			rownumbers="true" striped="true" fitColumns="true" fit="true"
			pagination="true" singleSelect="true" toolbar="#toolbar">
			<thead>
				<tr>
					<th field="account" width="20">账号</th>
					<th field="name" width="20">名称</th>
					<th field="alias" width="20">别名</th>
					<th field="groupCode" width="20" formatter="groupFormatter">用户组</th>
					<th field="status" width="10" align='center'
						formatter="statusFormatter">状态</th>
					<th field="create_time" width="20" align='center'>创建时间</th>
				</tr>
			</thead>
		</table>
	</div>
</body>
</body>

</html>